<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>NetTest: Basic API tests</title>
		<script type="text/javascript" src="nettest-swfobject.js"></script>
		<script>
			NetTest.reportingTextareaId = 'log_area';

			NetTest.testDownload = function(resultObj) {

				var handler = function(resultObj) {
					var textarea = document.getElementById(NetTest.reportingTextareaId);
					NetTest.misc.writeResultToTextarea(textarea, 'Download: ' +
					resultObj.verbose_summary().replace('\n', '') + ' (' + resultObj.method + ')\n')
				}

				NetTest.download("http://www.boston.com/business/ticker/Accordion.JPG", 2220043, handler);
				NetTest.download("http://www.boston.com/NONEXISTENT.JPG", -1, handler);
				NetTest.download("http://www.bls.gov/news.release/pdf/cpi.pdf", 128683, handler);
				NetTest.download("http://www.bls.gov/news.release/pdf/NONEXISTENT.pd2f", -1, handler);
				NetTest.download("http://www.eso.org/gallery/d/62848-2/2_2-MPG-ESO.jpg", 1447609, handler);
				NetTest.download("http://www.eso.org/gallery/d/NONEXISTENT.jpg", -1, handler);
			}

			NetTest.testUpload = function() {
				var handler = function(resultObj) {
					var textarea = document.getElementById(NetTest.reportingTextareaId);
					NetTest.misc.writeResultToTextarea(textarea, 'Upload:   ' +
						resultObj.verbose_summary().replace('\n', '') + ' (' + resultObj.method + ')\n')
				}

				NetTest.upload("http://google.com/", 1024 * 1024, handler);
				NetTest.upload("http://bitcast.vimeo.com/vimeo/assets/images/logo.gif", 1024 * 1024, handler);
			}

			NetTest.testPing = function() {
				var handler = function(resultObj) {
					var textarea = document.getElementById(NetTest.reportingTextareaId);
					NetTest.misc.writeResultToTextarea(textarea, 'Ping:     ' + 
						resultObj.verbose_summary().replace('\n', '') + ' (' + resultObj.method + ')\n')
				}

				NetTest.ping(NetTest.testFilePath + "1B", 1, handler);
				
				NetTest.ping("http://i.scribd.com/profiles/images/qlvbe7gixox0-tiny.jpg", 32, handler, true)
				NetTest.ping("http://i.scribd.com/profiles/images/NONEXISTENT.j2pg", 12, handler, true)
				
				NetTest.ping("http://www.instructables.com/files/deriv/FNG/UKA1/FGPXR9UR/FNGUKA1FGPXR9UR.TINY.jpg", 655, handler, true);
			}

			NetTest.testGeneral = function() {
				NetTest.testDownload();
				NetTest.testUpload();
				NetTest.testPing();
			}

			NetTest.testGeneral();
        </script>
	</head>
	<body style="background-color: #eee;">
		<center>
			<textarea id="log_area" style="width: 80%; height: 80%; #height: 30em;
				display:block; border: 1px solid #333; font-size: 12px;"></textarea>
		</center>

	</body>
</html>
